package com.myblog.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.myblog.mapper.ArticleMapper;
import com.myblog.pojo.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ArticleService {

    @Autowired
    ArticleMapper articleMapper;

    public PageInfo<Article> query(Integer pageNum,Integer pageSize){

        PageHelper.startPage(pageNum, pageSize);
        List<Article> articles = articleMapper.selectByParams();
        PageInfo<Article> pageInfo = new PageInfo<Article>(articles);

        return  pageInfo;
    }


}
